from django.db import models

# Create your models here.

class Activity(models.Model):
    STATUS_CHOICE = ((1,'立即报名'),(2,'报名截止'),(3,'活动结束'))

    # image = models.ImageField(max_length=200,verbose_name='活动图片地址',upload_to='activity')
    image = models.CharField(max_length=200,verbose_name='活动图片地址')
    title = models.CharField(max_length=50,verbose_name='标题')
    apply_time = models.DateTimeField(verbose_name='报名时间')
    start_time = models.DateTimeField(verbose_name='开始时间')
    end_time = models.DateTimeField(verbose_name='结束时间')
    city = models.CharField(max_length=20,verbose_name='举办城市')
    address = models.CharField(verbose_name='活动详细地址',max_length=50)
    sponsor = models.CharField(verbose_name='举办方',max_length=20)
    status = models.IntegerField(verbose_name='当前状态',choices=STATUS_CHOICE)
    description = models.TextField(verbose_name='活动描述')
    abstract = models.TextField(verbose_name='活动摘要')
    link = models.CharField(verbose_name='官网链接',max_length=200)

    class Meta:

        db_table = 'activities'
        verbose_name = '活动'
        verbose_name_plural = verbose_name
        # ordering = ['-start_time'] # 指明默认排序

    def __str__(self):
        return self.title


